package com.hr.controller;

import com.hr.pojo.Empyloyee;
import com.hr.service.EmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author DSL
 * @create 2024-10-28 17:37
 */
@RestController// @Controller + @ResponseBody: 返回json数据
@RequestMapping("employee")//用于设置请求路径的前缀
@Slf4j//日志相关的注解
public class EmployeeController {
    @Autowired

    private EmployeeService employeeService;
//    测试类的作用controller 层接收数据，返回结果
    @GetMapping("all")
    public List<Empyloyee> employeeList(){
        List<Empyloyee> all=employeeService.findAll();
//        log.info("查询到全部人数：{起到占位作用，会把后面的值传进来 all}",all);
        log.info("查询到全部人数：{}",all);
        return all;
    }
}
